package view
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	public class ExtendButton extends Sprite
	{
		public var title:TextField = new TextField();
		public var upDown:Boolean = true;;
		public function ExtendButton()
		{
			init();
		}
		private function init():void{
			this.addChild(title);
			title.x = 8;
			title.y = 3;
			title.width = 60;
			title.height = 18;
			title.selectable = false;
			title.htmlText = "<b><font color='#635d54' size='12'><a href='event:myText'>经典横款</a></font></b>";
			drawUp();
			title.addEventListener(MouseEvent.CLICK,onClick);
		}
		private function onClick(event:MouseEvent):void{
			if(upDown){
				drawDown();
				upDown = false;
			}else{
				drawUp();
				upDown = true;
			}
			
		}
		private function drawUp():void{
			this.graphics.clear();
			this.graphics.lineStyle(1,0xbbb5ac);
			this.graphics.beginFill(0x9c958d);
			this.graphics.moveTo(65,10);
			this.graphics.lineTo(73,10);
			this.graphics.lineTo(69,18);
			this.graphics.moveTo(65,10);
			this.graphics.endFill();
		}
		private function drawDown():void{
			this.graphics.clear();
			this.graphics.lineStyle(1,0xbbb5ac);
			this.graphics.moveTo(0,0);
			this.graphics.lineTo(82,0);
			this.graphics.lineTo(82,20);
			this.graphics.lineTo(132,20);
			this.graphics.lineTo(132,136);
			this.graphics.lineTo(0,136);
			this.graphics.lineTo(0,0);
			
			this.graphics.beginFill(0x9c958d);
			this.graphics.moveTo(69,10);
			this.graphics.lineTo(65,18);
			this.graphics.lineTo(73,18);
			this.graphics.moveTo(69,10);
			this.graphics.endFill();
		}
	}
}